<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:s="http://jboss.com/products/seam/taglib"
	template="/WEB-INF/esquema/plantillaworkflow.xhtml">

	<!--
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/esquema/sidebar2.xhtml"/>
	</ui:define>
	-->
	
	<ui:define name="body">
		<div align="center">
			<br/>
			<strong>#{messages['analysis.header']}</strong>
			<rich:separator lineType="solid"/>
			<br/>
			<table width="500" border="1" cellpadding="0" cellspacing="0">
				<tr>
					<td>
					<table width="100%" border="0" align="center" cellpadding="0"
						cellspacing="0" bgcolor="#FFFFFF">
						<tr>
							<td width="50" valign="top">
								<h:graphicImage value="/img/int_ayuda.gif" width="45" height="43" />
							</td>
							<td width="500" class="tab">
								<h:outputText value="#{messages['analysis.message']}:" />
								<br/>
								<br/>
								<ul style="line-height:normal;">
									<li>#{messages['analysis.bullet1']}</li>
									<li>#{messages['analysis.bullet2']}</li>
								</ul>
							</td>
						</tr>
					</table>
					</td>
				</tr>
			</table>
			<br/>
		</div>
		<h:form>
			<div align="center">
				<br/>
				<strong>#{messages['analysis.type']}</strong>
				<rich:separator lineType="solid"/>
				<h:panelGrid columns="2">
					<h:outputText value="#{messages['analysis.request_type']}" />
					<h:selectOneMenu value="#{transactionController.requestType}">
						<f:selectItems value="#{transactionController.requestTypes}"/>
						<a4j:support event="onkeyup" reRender="subType"/>
						<a4j:support event="onchange" reRender="subType"/>
					</h:selectOneMenu>
					
					<h:outputText value="#{messages['analysis.request_subtype']}" />
					<h:selectOneMenu id="subType" value="#{transactionController.requestSubType}">
						<f:selectItems value="#{transactionController.requestSubTypes}"/>
					</h:selectOneMenu>
				</h:panelGrid>
			</div>
			<br/>
			<br/>
			<div align="center">
				<br/>
				<strong>#{messages['analysis.property_list']}</strong>
				<rich:separator lineType="solid"/>
				<br/>
				<a4j:commandLink ajaxSingle="true" oncomplete="#{rich:component('selectParcelPanel')}.show()">
					<f:setPropertyActionListener value="#{true}" target="#{selectParcelHelper.addToList}" />
					<f:setPropertyActionListener value="transactionController.selectedParcelData" target="#{selectParcelHelper.selectedParcelDataField}" />
					<f:setPropertyActionListener value="transactionController.addParcelData" target="#{selectParcelHelper.addToListMethod}" />
					<f:setPropertyActionListener value="#{rich:clientId('parcelDataTable')}" target="#{selectParcelHelper.reRenderComponents}" />
					<h:outputText value="Seleccionar predio"/>
				</a4j:commandLink>
				<br/>
				<br/>
				<rich:dataTable id="parcelDataTable" value="#{transactionController.parcelDataList}" var="parcelData" rowKeyVar="row">
					<rich:column>
						<f:facet name="header">Nombre</f:facet>
						<h:outputText value="#{parcelData.label}"/>
					</rich:column>
					<rich:column>
						<f:facet name="header">Ficha de campo</f:facet>
						<h:outputText value="#{parcelData.fieldTab}"/>
					</rich:column>
					<rich:column>
						<f:facet name="header">Clave municipal</f:facet>
						<h:outputText value="#{parcelData.municipalKey}"/>
					</rich:column>
					<rich:column>
						<f:facet name="header">Clave catastral</f:facet>
						<h:outputText value="#{parcelData.cadastralKey}"/>
					</rich:column>
					<rich:column>
						<f:facet name="header"></f:facet>
						<a4j:commandLink action="#{transactionController.deleteSelectedParcelData}" reRender="parcelDataTable">
							<f:setPropertyActionListener target="#{transactionController.currentRow}" value="#{row}" />
							<h:outputText value="#{messages['button.delete']}" />
						</a4j:commandLink>
					</rich:column>
				</rich:dataTable>
			</div>
			<br/>
			<br/>
			<div align="center">
				<br/>
				<strong>#{messages['analysis.dictum']}</strong>
				<rich:separator lineType="solid"/>
				<br/>
				<rich:editor value="#{transactionController.analysisDictum}" width="400" height="150">
				</rich:editor>
			</div>
				
			<br/>
			<br/>
			<div align="center">
				<br/>
				<strong>#{messages['analysis.additional_observations']}</strong>
				<rich:separator lineType="solid"/>
				<br/>
				<rich:editor value="#{transactionController.additionalObservations}" width="400" height="150">
				</rich:editor>
			</div>
			<br/>
			<br/>
			<div align="center">
				<br/>
				<strong>#{messages['analysis.request_dictum']}</strong>
				<rich:separator lineType="solid"/>
				<br/>
				<h:selectOneRadio value="#{transactionController.requestToProceed}">
					<f:selectItem itemLabel="#{messages['analysis.request_proceeds']}" itemValue="true"/>
					<f:selectItem itemLabel="#{messages['analysis.request_notproceeds']}" itemValue="false"/>
				</h:selectOneRadio>
			</div>
			<br/>
			<br/>
			<br/>
			<div align="center">
				<a4j:commandButton value="#{messages['button.ok']}" action="#{transactionProcess.endAnalysis}"/>
				#{'  '}
				<a4j:region>
					<a4j:commandButton value="#{messages['button.l8r']}" action="home">
						<s:conversationPropagation type="end"/>
					</a4j:commandButton>
				</a4j:region>
			</div>
		</h:form>
		
		<ui:include src="/WEB-INF/includes/selectParcel.xhtml" />
	</ui:define>
	
</ui:composition>
